﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace udqlmttsth_n4
{
    public partial class FormSQLConfig : Form
    {
        public FormSQLConfig()
        {
            InitializeComponent();
        }

        private void checkBoxDungTatCaMacDinh_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxDungTatCaMacDinh.Checked)
            {
                checkBoxDungTaiKhoanWindows.Visible = false;
                textBoxTenMayChu.Text = "(local)";
                textBoxTenMayChu.BackColor = Color.AliceBlue;
                textBoxTenMayChu.ReadOnly = true;
                textBoxTaiKhoan.BackColor = Color.AliceBlue;
                textBoxTaiKhoan.ReadOnly = true;
                textBoxMatKhau.BackColor = Color.AliceBlue;
                textBoxMatKhau.ReadOnly = true;
            }
            else
            {
                checkBoxDungTaiKhoanWindows.Visible = true;
                textBoxTenMayChu.Text = "";
                textBoxTenMayChu.BackColor = Color.White;
                textBoxTenMayChu.ReadOnly = false;
                textBoxTaiKhoan.BackColor = Color.White;
                textBoxTaiKhoan.ReadOnly = false;
                textBoxMatKhau.BackColor = Color.White;
                textBoxMatKhau.ReadOnly = false;
                textBoxTenMayChu.Focus();
            }
        }

        private void checkBoxDungTaiKhoanWindows_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxDungTaiKhoanWindows.Checked)
            {
                checkBoxDungTatCaMacDinh.Visible = false;
                textBoxTaiKhoan.ReadOnly = true;
                textBoxMatKhau.ReadOnly = true;
                textBoxTaiKhoan.BackColor = Color.AliceBlue;
                textBoxMatKhau.BackColor = Color.AliceBlue;
            }
            else
            {
                checkBoxDungTatCaMacDinh.Visible = true;
                textBoxTaiKhoan.ReadOnly = false;
                textBoxMatKhau.ReadOnly = false;
                textBoxTaiKhoan.BackColor = Color.White;
                textBoxMatKhau.BackColor = Color.White;
            }
        }
    }
}
